package com.zenchn.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

@ApiModel(value="定时调度任务",description="定时调度任务对象")
public class TSysScheduleTask implements Serializable {

    private static final long serialVersionUID = -9097981006386714237L;
    @NotEmpty(message = "调度任务ID不能为空")
    @ApiModelProperty(value="调度任务ID")
    private String scheduleId;

    @ApiModelProperty(value="创建时间",hidden = true)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @NotEmpty(message = "调度任务名称不能为空")
    @ApiModelProperty(value="调度任务名称")
    private String scheduleName;

    @NotEmpty(message = "调度类型不能为空")
    @ApiModelProperty(value="调度类型")
    private String scheduleTypeId;

    @NotEmpty(message = "调度执行类不能为空")
    @ApiModelProperty(value="调度执行类")
    private String schedulerClass;

    @NotNull(message = "是否启用不能为空")
    @ApiModelProperty(value="是否启用")
    private Boolean isEnable;

    @ApiModelProperty(value="cron调度规则")
    private String cron;

    @ApiModelProperty(value="调度间隔时间(毫秒)")
    private Long fixedDelay;

    @ApiModelProperty(value="备注")
    private String memo;

    public String getScheduleId() {
        return scheduleId;
    }

    public void setScheduleId(String scheduleId) {
        this.scheduleId = scheduleId == null ? null : scheduleId.trim();
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public String getScheduleName() {
        return scheduleName;
    }

    public void setScheduleName(String scheduleName) {
        this.scheduleName = scheduleName == null ? null : scheduleName.trim();
    }

    public String getScheduleTypeId() {
        return scheduleTypeId;
    }

    public void setScheduleTypeId(String scheduleTypeId) {
        this.scheduleTypeId = scheduleTypeId == null ? null : scheduleTypeId.trim();
    }

    public String getSchedulerClass() {
        return schedulerClass;
    }

    public void setSchedulerClass(String schedulerClass) {
        this.schedulerClass = schedulerClass == null ? null : schedulerClass.trim();
    }

    public Boolean getIsEnable() {
        return isEnable;
    }

    public void setIsEnable(Boolean isEnable) {
        this.isEnable = isEnable;
    }

    public String getCron() {
        return cron;
    }

    public void setCron(String cron) {
        this.cron = cron == null ? null : cron.trim();
    }

    public Long getFixedDelay() {
        return fixedDelay;
    }

    public void setFixedDelay(Long fixedDelay) {
        this.fixedDelay = fixedDelay;
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo == null ? null : memo.trim();
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", scheduleId=").append(scheduleId);
        sb.append(", createTime=").append(createTime);
        sb.append(", scheduleName=").append(scheduleName);
        sb.append(", scheduleTypeId=").append(scheduleTypeId);
        sb.append(", schedulerClass=").append(schedulerClass);
        sb.append(", isEnable=").append(isEnable);
        sb.append(", cron=").append(cron);
        sb.append(", fixedDelay=").append(fixedDelay);
        sb.append(", memo=").append(memo);
        sb.append("]");
        return sb.toString();
    }
}